package com.mairuide.base_dict.plane.controller;

import com.mairuide._frame.base.BaseController;
import com.mairuide.base_dict.plane.dto.PlaneInfoManageDto;
import com.mairuide.base_dict.plane.pojo.PlaneInfoManage;
import com.mairuide.base_dict.plane.service.PlaneInfoManageService;
import com.mairuide.entity.PageResult;
import com.mairuide.entity.Result;
import com.mairuide.entity.StatusCode;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @Description
 * @auther 刘中华
 * @create 2019-06-04 15:02
 */
@RequestMapping("/plane")
@Controller
public class PlaneInfoManageController extends BaseController {
    @Autowired
    PlaneInfoManageService planeInfoManageService;

    @RequestMapping("index")
    public String index(){
        return "/base_dict/plane/plane";
    }

    @RequestMapping("openPlaneDialog")
    public String openHolidayDialog(){
        return "/base_dict/plane/openPlaneDialog";
    }

    //查询节假日
    @RequestMapping("findOneById")
    @ResponseBody
    public Result findOneById(Integer id){
        PlaneInfoManage planeInfoManage = planeInfoManageService.findOnebyId(id);
        return new Result(true, StatusCode.OK,"保存成功" ,planeInfoManage);
    }

    //保存特殊日期
    @RequestMapping("save")
    @ResponseBody
    public Result save(PlaneInfoManage sd){
        planeInfoManageService.save(sd);
        return new Result(true, StatusCode.OK,"保存成功" );
    }
    //删除特殊日期
    @RequestMapping("del")
    @ResponseBody
    public Result del(Integer id){
        planeInfoManageService.del(id);
        return new Result(true, StatusCode.OK,"删除成功" );
    }
    //分页查询特殊日期
    @RequestMapping("page")
    @ResponseBody
    public PageResult query(PlaneInfoManageDto dto){
        PageResult page = planeInfoManageService.findByPage(dto);
        return page;
    }
}
